home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Utilities / QuickTime VCR 3.5 / MP Source / vcr.c < prev   
Encoding:
C/C++ Source or Header  |  1992-08-17  |  15.2 KB  |  729 lines  |  [TEXT/KAHL]

  1. #include <stdio.h>
  2. #include <oops.h>
  3. #include <Movies.h>
  4.  
  5. #include "myQuickTime.h"
  6.  
  7. #include "Dlog.h"
  8. #include "Alert_Class.h"
  9.  
  10. #include "vcr.h"
  11. #include "mycolors.h"
  12.  
  13. extern EventRecord gEvent;
  14. extern Alert_Class *myAlert;
  15. extern QT *myQT;
  16.  
  17. Rect myRects[4]; // This global saves calls to GetDItem over and over
  18.                 // these rects are user Items in the resource file
  19.                 // used to place the buttons where I want them.
  20.  
  21. Boolean blink = false;
  22. long oldTick, newTick;
  23. int currentrect = 0;
  24. Boolean clockSet = false;
  25.  
  26. extern Boolean opened;
  27.  
  28.  
  29. /*....................................................................*/
  30. VCR::VCR()
  31. {
  32.     Buttons myButtons;
  33.     int i;
  34.     int rsrcNum;
  35.     
  36.     myButtons = (*this).myButtons;
  37.     
  38.     
  39.     for(i = 0,rsrcNum = BASE_ICON-1; i < LAST_BUTTON; i++,rsrcNum++) {
  40.         myButtons.button[i] = false;
  41.         myButtons.buttonRNum[i] = rsrcNum;
  42.     }
  43.     (*this).myButtons = myButtons;
  44.     vcr_mode = stopped;
  45. }
  46. /*....................................................................*/
  47. VCR::~VCR()
  48. {
  49.     Buttons myButtons;
  50.     int i;
  51.     int rsrcNum;
  52.     
  53.     myButtons = (*this).myButtons;
  54.     
  55.     
  56.     for(i = 0,rsrcNum = BASE_ICON; i < LAST_BUTTON; i++,rsrcNum++) {
  57.         myButtons.button[i] = false;
  58.         myButtons.buttonRNum[i] = rsrcNum;
  59.     }
  60.     (*this).myButtons = myButtons;
  61. }
  62. /*....................................................................*/
  63. void VCR::loadResource( int number)    // load resource from resource file
  64. {
  65.     DialogPtr myDlog;
  66.     
  67.     /*-------------------------
  68.     Shadow for purging problems
  69.     -------------------------*/
  70.     myDlog = this->myDlog;
  71.     rsrcNumber = number;
  72.     myDlog = GetNewDialog(number,0L,(WindowPtr)-1L);
  73.     /*-------------------------
  74.     Copy back from shadow
  75.     -------------------------*/
  76.     this->myDlog = myDlog;
  77.  
  78.     if ( myDlog == 0L  ) {
  79.         SysBeep(7);
  80.         (*myAlert).AlertStop("\pFatal Error",
  81.                             "\pUnable to allocate new dialog",
  82.                             "\pDlog::loadResource",NULL);
  83.     } /* end if */
  84.     
  85.     CouldDialog(rsrcNumber);    // could be purged so lock it down
  86.  
  87.  
  88.  
  89.     
  90.     GetDItem(myDlog,PROGRESS_1,&itemType,&itemHandle,&itemRect);
  91.     myRects[0] = itemRect;
  92.     
  93.     GetDItem(myDlog,PROGRESS_2,&itemType,&itemHandle,&itemRect);
  94.     myRects[1] = itemRect;
  95.  
  96.     GetDItem(myDlog,PROGRESS_3,&itemType,&itemHandle,&itemRect);
  97.     myRects[2] = itemRect;
  98.  
  99.     GetDItem(myDlog,PROGRESS_4,&itemType,&itemHandle,&itemRect);
  100.     myRects[3] = itemRect;
  101.  
  102.     
  103. }
  104. /*....................................................................*/
  105. int VCR::HandleDialogItem(int itemHit, Point thePoint, int thePart)
  106. {
  107.     DialogPtr myDlog;
  108.     Buttons myButtons;
  109.     
  110.     myDlog = this->myDlog;
  111.     myButtons = (*this).myButtons;
  112.     
  113.     switch ( itemHit  ) {
  114.         case PLAY_BUTTON:
  115.             if (!opened) { SysBeep(7); break;}
  116.             if (myButtons.button[PLAY_BUTTON] == false) {
  117.                 (*this).myButtons = myButtons;
  118.                 ButtonsAndValues(PLAY_BUTTON);
  119.                 (*this).vcr_mode = playing;
  120.                 (*myQT).PlayMovie();
  121.             }
  122.         break;
  123.         
  124.         case STOP_BUTTON:
  125.             if (!opened) { SysBeep(7); break;}
  126.  
  127.             if (myButtons.button[STOP_BUTTON] == false) {
  128.                 (*this).vcr_mode = stopped;
  129.                 (*this).myButtons = myButtons;
  130.                 ButtonsAndValues(STOP_BUTTON);
  131.                 myButtons = (*this).myButtons;
  132.                 myButtons.button[STOP_BUTTON] = false;
  133.                 (*this).myButtons = myButtons;
  134.                 RedrawButtons();
  135.                 DrawAllProgress(sl_darkGray);
  136.                 (*myQT).StopMyMovie();
  137.             }
  138.         break;
  139.         
  140.         case FF_BUTTON:
  141.             if (!opened) { SysBeep(7); break;}
  142.             if (myButtons.button[FF_BUTTON] == false) {
  143.                 (*this).vcr_mode = fastforward;
  144.                 (*this).myButtons = myButtons;
  145.                 ButtonsAndValues(FF_BUTTON);
  146.                 (*myQT).FFMyMovie();
  147.             }
  148.         break;
  149.         
  150.         case GO_START_BUTTON:
  151.             if (!opened) { SysBeep(7); break;}
  152.             if (myButtons.button[GO_START_BUTTON] == false) {
  153.                 (*this).myButtons = myButtons;
  154.                 (*this).vcr_mode = gotostart;
  155.                 ButtonsAndValues(GO_START_BUTTON);
  156.                 myButtons = (*this).myButtons;
  157.                 myButtons.button[GO_START_BUTTON] = false;
  158.                 (*this).myButtons = myButtons;
  159.                 RedrawButtons();
  160.                 (*myQT).GoStartMyMovie();
  161.             }
  162.             break;
  163.             
  164.         case GO_END_BUTTON:
  165.             if (!opened) { SysBeep(7); break;}
  166.             if (myButtons.button[GO_END_BUTTON] == false) {
  167.                 (*this).vcr_mode = gotoend;
  168.                 (*this).myButtons = myButtons;
  169.                 ButtonsAndValues(GO_END_BUTTON);
  170.                 myButtons = (*this).myButtons;
  171.                 myButtons.button[GO_END_BUTTON] = false;
  172.                 (*this).myButtons = myButtons;
  173.                 RedrawButtons();
  174.                 (*myQT).GoEndMyMovie();
  175.             }
  176.             break;
  177.             
  178.         case RW_BUTTON:
  179.             if (!opened) { SysBeep(7); break;}
  180.             if (myButtons.button[RW_BUTTON] == false) {
  181.                 (*this).vcr_mode = re_wind;
  182.                 (*this).myButtons = myButtons;
  183.                 ButtonsAndValues(RW_BUTTON);
  184.                 (*myQT).RWMyMovie();
  185.             }
  186.             break;
  187.         case CLOCK_BOX:
  188.             clockSet = true;
  189.             break;
  190.             
  191.         case VCR_BOX:{
  192.                 Rect bRect;
  193.                 SelectWindow(myDlog);
  194.                 bRect = screenBits.bounds;
  195.                 DragWindow(myDlog,gEvent.where, &bRect);
  196.             }    
  197.             break;
  198.         
  199.         case TAPE_SLOT:
  200.             if (opened) {
  201.                 (*myQT).CloseMovie();
  202.                 opened = false;
  203.             }
  204.             else {
  205.                 opened = (*myQT).OpenMovie();
  206.             }    
  207.         
  208.             break;
  209.             
  210.         case VOLUME_UP:
  211.             if (!opened) {SysBeep(7);break;}
  212.             (*myQT).HandleVolume(UP);
  213.             FlashButton(VOLUME_UP);
  214.             break;
  215.             
  216.         case VOLUME_DOWN:
  217.             if (!opened) {SysBeep(7);break;}
  218.             (*myQT).HandleVolume(DOWN);
  219.             FlashButton(VOLUME_DOWN);
  220.             break;
  221.             
  222.         case CLOSE_VCR_BOX:
  223.             FlashButton(CLOSE_VCR_BOX);
  224.             HideWindow(myDlog);
  225.             break;    
  226.         default: break;
  227.     } /* end switch */
  228.     //(*this).myButtons = myButtons;
  229. }
  230. /*....................................................................*/
  231. void VCR::RedrawDialog()
  232. {
  233.     DialogPtr myDlog;
  234.     GrafPtr oldPort;
  235.     int i;
  236.     
  237.     GetPort(&oldPort);
  238.     myDlog = (*this).myDlog;
  239.     
  240.     SetPort(myDlog);
  241.     DrawDialog(myDlog);
  242.     RedrawButtons();
  243.     RedrawStatus();
  244.     RedrawTime();
  245.     SetPort(oldPort);
  246. }
  247. /*....................................................................*/
  248. void VCR::ButtonsAndValues(int itemHit)
  249. {
  250.     DialogPtr myDlog;
  251.     int i;
  252.     Buttons myButtons;
  253.     
  254.     
  255.     myDlog = (*this).myDlog;
  256.     myButtons = (*this).myButtons;
  257.  
  258.     for(i = 1; i < LAST_BUTTON; i++) {
  259.         if (i == itemHit) {
  260.             myButtons.button[i] = true;
  261.         }
  262.         else {
  263.             myButtons.button[i] = false;
  264.         }
  265.     }
  266.  
  267.     (*this).myButtons = myButtons;
  268.     RedrawButtons();
  269. }
  270. /*....................................................................*/
  271. void VCR::RedrawButtons()
  272. {
  273.     DialogPtr myDlog;
  274.     int itemType;
  275.     Handle itemHandle;
  276.     Rect itemRect;
  277.     CIconHandle    icon;
  278.     int i;
  279.     GrafPtr oldPort;
  280.     Buttons myButtons;
  281.     RGBColor fc,bc;
  282.     RGBColor temp;
  283.     
  284.     GetForeColor(&fc);
  285.     GetBackColor(&bc);
  286.     
  287.     temp.red = temp.green = temp.blue = 0xffff;
  288.     RGBBackColor(&temp);
  289.     temp.red = temp.green = temp.blue = 0x0000;
  290.     RGBForeColor(&temp);
  291.     
  292.     GetPort(&oldPort);
  293.     myDlog = (*this).myDlog;
  294.     myButtons = (*this).myButtons;
  295.     
  296.     SetPort(myDlog);
  297.     
  298.     for(i = 1; i < LAST_BUTTON; i++) {
  299.         if (myButtons.button[i] == true) {
  300.             GetDItem(myDlog,i,&itemType,&itemHandle,&itemRect);
  301.             icon = GetCIcon(myButtons.buttonRNum[i]);
  302.             if (icon == NULL) {
  303.                 SysBeep(7);
  304.                 (*myAlert).AlertStop("\pFatal Error",
  305.                             "\pUnable to get cicn resource",
  306.                             "\pVCR::RedrawButtons",NULL);
  307.             }
  308.             
  309.             HLock( icon );
  310.             HLock( (**icon).iconData );
  311.         
  312.             (**icon).iconPMap.baseAddr = *(**icon).iconData;
  313.             (**icon).iconMask.baseAddr = (Ptr)&(**icon).iconMaskData;
  314.             
  315.             CopyBits( &(**icon).iconPMap, &myDlog->portBits,
  316.                         &(**icon).iconPMap.bounds, &itemRect, notSrcCopy, 0 );
  317.         
  318.             HUnlock( (**icon).iconData );
  319.             HUnlock( icon );
  320.             DisposCIcon(icon);
  321.         }
  322.         else {
  323.             GetDItem(myDlog,i,&itemType,&itemHandle,&itemRect);
  324.             icon = GetCIcon(myButtons.buttonRNum[i]);
  325.             if (icon == NULL) {
  326.                 SysBeep(7);
  327.                 (*myAlert).AlertStop("\pFatal Error",
  328.                             "\pUnable to get cicn resource",
  329.                             "\pVCR::RedrawButtons",NULL);
  330.             }
  331.             HLock(icon);
  332.             PlotCIcon(&itemRect, icon);
  333.             HUnlock(icon);
  334.             DisposCIcon(icon);
  335.         }
  336.     }
  337.     
  338.     //(*this).myButtons = myButtons;
  339.     
  340.     /* draw volume controls */
  341.     GetDItem(myDlog,VOLUME_UP,&itemType,&itemHandle,&itemRect);
  342.     icon = GetCIcon(VOLUME_UP_CICN);
  343.     if (icon == NULL) {
  344.         SysBeep(7);
  345.         (*myAlert).AlertStop("\pFatal Error",
  346.                     "\pUnable to get cicn resource",
  347.                     "\pVCR::RedrawButtons",NULL);
  348.     }
  349.     HLock(icon);
  350.     PlotCIcon(&itemRect, icon);
  351.     HUnlock(icon);
  352.     DisposCIcon(icon);
  353.     
  354.     GetDItem(myDlog,VOLUME_DOWN,&itemType,&itemHandle,&itemRect);
  355.     icon = GetCIcon(VOLUME_DOWN_CICN);
  356.     if (icon == NULL) {
  357.         SysBeep(7);
  358.         (*myAlert).AlertStop("\pFatal Error",
  359.                     "\pUnable to get cicn resource",
  360.                     "\pVCR::RedrawButtons",NULL);
  361.     }
  362.     HLock(icon);
  363.     PlotCIcon(&itemRect, icon);
  364.     HUnlock(icon);
  365.     DisposCIcon(icon);
  366.     
  367.     GetDItem(myDlog,CLOSE_VCR_BOX,&itemType,&itemHandle,&itemRect);
  368.     icon = GetCIcon(CLOSE_CICN);
  369.     if (icon == NULL) {
  370.         SysBeep(7);
  371.         (*myAlert).AlertStop("\pFatal Error",
  372.                     "\pUnable to get cicn resource",
  373.                     "\pVCR::RedrawButtons",NULL);
  374.     }
  375.     HLock(icon);
  376.     PlotCIcon(&itemRect, icon);
  377.     HUnlock(icon);
  378.     DisposCIcon(icon);
  379.     
  380.     RGBForeColor(&fc);
  381.     RGBBackColor(&bc);
  382.     
  383.     SetPort(oldPort);
  384. }
  385. /*....................................................................*/
  386. void VCR::RedrawStatus()
  387. {
  388.     DialogPtr myDlog;
  389.     int itemType;
  390.     Handle itemHandle;
  391.     Rect itemRect;
  392.     int i;
  393.     GrafPtr oldPort;
  394.     RGBColor fc,bc;
  395.     Buttons myButtons;
  396.  
  397.     myDlog = (*this).myDlog;
  398.     
  399.     
  400.     GetForeColor(&fc);
  401.     GetBackColor(&bc);
  402.     
  403.     
  404.     GetPort(&oldPort);
  405.     myButtons = (*this).myButtons;
  406.     
  407.     GetDItem(myDlog,STATUS_BOX,&itemType,&itemHandle,&itemRect);
  408.     SetColor(sl_black);
  409.     PaintRect(&itemRect);
  410.     
  411.     SetColor(sl_darkGray);
  412.     
  413.     // draw border    
  414.     MoveTo(itemRect.left,itemRect.bottom + 1);
  415.     LineTo(itemRect.right + 1,itemRect.bottom + 1);
  416.     
  417.     MoveTo(itemRect.right + 1, itemRect.top);
  418.     LineTo(itemRect.right + 1, itemRect.bottom + 1);
  419.     
  420.     UpdateProgress();
  421.     SetPort(oldPort);
  422.     
  423.     RGBForeColor(&fc);
  424.     RGBBackColor(&bc);
  425.     
  426. }
  427. /*....................................................................*/
  428. void VCR::RedrawTime()
  429. {
  430.     DialogPtr myDlog;
  431.     int itemType;
  432.     Handle itemHandle;
  433.     Rect itemRect;
  434.     int i;
  435.     GrafPtr oldPort;
  436.     RGBColor fc,bc;
  437.     DateTimeRec myTime;
  438.     char time[80];
  439.     char day[6];
  440.     
  441.     
  442.     GetForeColor(&fc);
  443.     GetBackColor(&bc);
  444.     
  445.     GetPort(&oldPort);
  446.     myDlog = (*this).myDlog;
  447.     myButtons = (*this).myButtons;
  448.     
  449.     SetPort(myDlog);
  450.     
  451.     GetDItem(myDlog,CLOCK_BOX,&itemType,&itemHandle,&itemRect);
  452.     SetColor(sl_black);
  453.     PaintRect(&itemRect);
  454.     
  455.     SetColor(sl_darkGray);
  456.     // draw border    
  457.     MoveTo(itemRect.left,itemRect.bottom + 1);
  458.     LineTo(itemRect.right + 1,itemRect.bottom + 1);
  459.     
  460.     MoveTo(itemRect.right + 1, itemRect.top);
  461.     LineTo(itemRect.right + 1, itemRect.bottom + 1);
  462.     
  463.     GetTime(&myTime);
  464.     
  465.     switch(myTime.dayOfWeek) {
  466.         case 1:
  467.             sprintf(day,"SUN");
  468.             break;
  469.         case 2:
  470.             sprintf(day,"MON");
  471.             break;
  472.         case 3:
  473.             sprintf(day,"TUE");
  474.             break;
  475.         case 4:
  476.             sprintf(day,"WED");
  477.             break;
  478.         case 5:
  479.             sprintf(day,"THU");
  480.         break;
  481.         case 6:
  482.             sprintf(day,"FRI");
  483.             break;
  484.         case 7:
  485.             sprintf(day,"SAT");
  486.             break;
  487.         default: break;
  488.     }
  489.     
  490.     if (!clockSet) {
  491.         if (blink) {
  492.             SetColor(sl_white);
  493.             sprintf(time,"12:00");
  494.             MoveTo(itemRect.left+12,itemRect.bottom-12);
  495.             DrawString(CtoPstr(time));
  496.             
  497.             //sprintf(day,"???");
  498.             //MoveTo(itemRect.right - 30, itemRect.bottom-12);
  499.             //DrawString(CtoPstr(day));
  500.         }
  501.         
  502.     }
  503.     else {    
  504.         
  505.         if (blink) {
  506.             SetColor(sl_white);
  507.             //sprintf(time,"%02d:%02d %02d",myTime.hour,myTime.minute,myTime.second);
  508.             sprintf(time,"%02d:%02d",myTime.hour,myTime.minute);
  509.             MoveTo(itemRect.left+12,itemRect.bottom-12);
  510.             DrawString(CtoPstr(time));
  511.             
  512.             MoveTo(itemRect.right - 30, itemRect.bottom-12);
  513.             DrawString(CtoPstr(day));
  514.         }
  515.         else {
  516.             SetColor(sl_white);
  517.             //sprintf(time,"%02d %02d %02d",myTime.hour,myTime.minute,myTime.second);
  518.             sprintf(time,"%02d %02d",myTime.hour,myTime.minute);
  519.             MoveTo(itemRect.left+12,itemRect.bottom-12);
  520.             DrawString(CtoPstr(time));
  521.             
  522.             MoveTo(itemRect.right - 30, itemRect.bottom-12);
  523.             DrawString(CtoPstr(day));
  524.         }
  525.     }
  526.     
  527.     
  528.     SetPort(oldPort);
  529.     
  530.     RGBForeColor(&fc);
  531.     RGBBackColor(&bc);
  532. }
  533. /*....................................................................*/
  534. void VCR::UpdateProgress()
  535. {
  536.     DialogPtr myDlog;
  537.     GrafPtr oldPort;
  538.     RGBColor fc,bc;
  539.     Buttons myButtons;
  540.     
  541.     GetForeColor(&fc);
  542.     GetBackColor(&bc);
  543.     
  544.     GetPort(&oldPort);
  545.     myDlog = (*this).myDlog;
  546.     myButtons = (*this).myButtons;
  547.     
  548.     SetPort(myDlog);
  549.     
  550.     newTick = TickCount();
  551.     if (myButtons.button[PLAY_BUTTON] == true) {
  552.         if ( (newTick - oldTick) > 25) {
  553.             int i,j;
  554.             
  555.             i = currentrect;
  556.             currentrect++;
  557.             
  558.             if (currentrect > 3) currentrect = 0;            
  559.             j = currentrect;
  560.             Draw2Rects2Colors(myRects[i],sl_darkGray,myRects[j],sl_white);
  561.             oldTick = newTick;
  562.         }
  563.     }
  564.     else if (myButtons.button[FF_BUTTON] == true) {
  565.         if ( (newTick - oldTick) > 10) {
  566.             int i,j;
  567.             
  568.             i = currentrect;
  569.             currentrect++;
  570.             
  571.             if (currentrect > 3) currentrect = 0;            
  572.             j = currentrect;
  573.             Draw2Rects2Colors(myRects[i],sl_darkGray,myRects[j],sl_white);
  574.             oldTick = newTick;
  575.         }
  576.     }
  577.     else if (myButtons.button[RW_BUTTON] == true) {
  578.         if ( (newTick - oldTick) > 10) {
  579.             int i,j;
  580.             
  581.             i = currentrect;
  582.             
  583.             currentrect--;
  584.                 
  585.             if (currentrect < 0) currentrect = 3;
  586.             j = currentrect;
  587.             
  588.             Draw2Rects2Colors(myRects[i],sl_darkGray,myRects[j],sl_white);
  589.         
  590.             oldTick = newTick;
  591.         }
  592.     }
  593.     else {
  594.         
  595.         if ( (newTick - oldTick) > 120) {    
  596.             DrawAllProgress(sl_darkGray);
  597.             oldTick = newTick;
  598.             currentrect = 0;
  599.  
  600.         }
  601.  
  602.     }
  603.     
  604.     
  605.     
  606.     SetPort(oldPort);
  607.     
  608.     RGBForeColor(&fc);
  609.     RGBBackColor(&bc);
  610. }    
  611. /*....................................................................*/
  612. void VCR::DrawAllProgress(int color)
  613. {
  614.     int i;
  615.     GrafPtr oldPort;
  616.     RGBColor fc,bc;
  617.     
  618.     
  619.     GetForeColor(&fc);
  620.     GetBackColor(&bc);
  621.     
  622.     GetPort(&oldPort);
  623.     myDlog = (*this).myDlog;
  624.     SetPort(myDlog);
  625.     
  626.     SetColor(color);
  627.     for(i = 0; i < 4; i++) {
  628.         PaintRect(&myRects[i]);
  629.     }
  630.     
  631.     SetPort(oldPort);
  632.     
  633.     RGBForeColor(&fc);
  634.     RGBBackColor(&bc);
  635. }
  636. /*....................................................................*/
  637. void VCR::Draw2Rects2Colors(Rect r1, int color1, Rect r2, int color2)
  638. {
  639.     RGBColor fc,bc;
  640.     
  641.     GetForeColor(&fc);
  642.     GetBackColor(&bc);
  643.     
  644.     SetColor(color1);
  645.     PaintRect(&r1);
  646.     SetColor(color2);
  647.     PaintRect(&r2);
  648.     
  649.     RGBForeColor(&fc);
  650.     RGBBackColor(&bc);
  651. }
  652. /*....................................................................*/
  653. void VCR::ClearAllButtons()
  654. {
  655.     Buttons myButtons;
  656.     int i;
  657.     Boolean toDo = false;
  658.     
  659.     myButtons = (*this).myButtons;
  660.     
  661.         
  662.     for(i = 1; i < LAST_BUTTON; i++) {
  663.         if ( (toDo == false) && (myButtons.button[i] == true) ) {
  664.             toDo = true;
  665.         }
  666.         myButtons.button[i] = false;
  667.     }
  668.     
  669.     (*this).myButtons = myButtons;
  670.     
  671.     if (toDo) RedrawButtons();
  672. }
  673. /*....................................................................*/
  674. void VCR::FlashButton(int id)
  675. {
  676.     int itemType;
  677.     Handle itemHandle;
  678.     Rect itemRect;
  679.     CIconHandle    icon;
  680.     int CICN_NUM;
  681.     GrafPtr oldPort;
  682.     DialogPtr myDlog = (*this).myDlog;
  683.     RGBColor temp;
  684.     
  685.     GetPort(&oldPort);
  686.     SetPort(myDlog);
  687.     
  688.     temp.red = temp.green = temp.blue = 0xffff;
  689.     RGBBackColor(&temp);
  690.     temp.red = temp.green = temp.blue = 0x0000;
  691.     RGBForeColor(&temp);
  692.     
  693.     switch (id) {
  694.         case VOLUME_UP:
  695.             CICN_NUM = VOLUME_UP_CICN;
  696.             break;
  697.         case VOLUME_DOWN:
  698.             CICN_NUM = VOLUME_DOWN_CICN;
  699.             break;
  700.         default: return; break;
  701.     }
  702.     GetDItem(myDlog,id,&itemType,&itemHandle,&itemRect);
  703.     icon = GetCIcon(CICN_NUM);
  704.     if (icon == NULL) {
  705.         SysBeep(7);
  706.         (*myAlert).AlertStop("\pFatal Error",
  707.                     "\pUnable to get cicn resource",
  708.                     "\pVCR::FlashButton",NULL);
  709.     }
  710.     
  711.     HLock( icon );
  712.     HLock( (**icon).iconData );
  713.     (**icon).iconPMap.baseAddr = *(**icon).iconData;
  714.     (**icon).iconMask.baseAddr = (Ptr)&(**icon).iconMaskData;
  715.     
  716.     CopyBits( &(**icon).iconPMap, &myDlog->portBits,
  717.                 &(**icon).iconPMap.bounds, &itemRect, notSrcCopy, 0 );
  718.  
  719.     SystemTask();
  720.     (*myQT).MyMoviesTask();
  721.     
  722.     PlotCIcon(&itemRect, icon);
  723.     HUnlock( (**icon).iconData );
  724.     HUnlock(icon);
  725.     DisposCIcon(icon);
  726.  
  727.     SetPort(oldPort);
  728.  
  729. }